package com.example.controller;

import com.example.pojo.Result;
import com.example.pojo.jobDescriptionPojo;
import com.example.pojo.standardWorkListPojo;
import com.example.pojo.taskListDataPojo;
import com.example.service.jobDescriptionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:jobDescriptionController
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/9/11 20:21
 * @Version 1.0
 */
@RestController
@Slf4j
public class jobDescriptionController {
    @Autowired
    private jobDescriptionService jobDescriptionService;
    @PostMapping("/insertItemJobDescription")
    public Result insertItemJobDescription(@RequestBody jobDescriptionPojo jobDescriptionPojo){
        jobDescriptionService.insertOne(jobDescriptionPojo);
        return Result.success("插入成功");
    }
    //点击树形导航，筛选数据
    @PostMapping("/queryJobDescription")
    public Result queryJobDescription(@RequestBody jobDescriptionPojo jobDescriptionPojo){
        List<jobDescriptionPojo> jobDescriptionPojoList=jobDescriptionService.queryAllByThree(jobDescriptionPojo);
        return Result.success(jobDescriptionPojoList);
    }
    //修改一行数据
    @PostMapping("/editJobDescription")
    public Result editJobDescription(@RequestBody jobDescriptionPojo jobDescriptionPojo){
        jobDescriptionService.eidtOne(jobDescriptionPojo);
        return Result.success("修改成功");
    }
    //根据id，删除一行数据
    @PostMapping("/deleteJobDescription")
    public Result deleteJobDescription(@RequestBody jobDescriptionPojo jobDescriptionPojo){
        jobDescriptionService.deleteOnebyId(jobDescriptionPojo);
        return Result.success("删除成功");
    }
    //对标准工作，插入一行数据
    @PostMapping("insertStandardWorkListJobDescription")
    public Result insertStandardWorkListJobDescription(@RequestBody standardWorkListPojo standardWorkListPojo){
        jobDescriptionService.insertStandardWorkList(standardWorkListPojo);
        return Result.success("插入成功");
    }
    //辅助函数，对标准工作中，查询出所有数据
    @PostMapping("/inquiryStandardWorkListAllJobDescription")
    public Result inquiryStandardWorkListAllJobDescription(){
        List<standardWorkListPojo> pojos=jobDescriptionService.inquiryStandardWorkListAll();
        return Result.success(pojos);
    }
    //辅助函数，对标准工作中，根据ID，修改一行数据,修改所有数据
    @PostMapping("/upDataStandardWorkListJobDescription")
    public Result upDataStandardWorkListJobDescription(@RequestBody standardWorkListPojo pojo){
        jobDescriptionService.upDataStandardWorkList(pojo);
        return Result.success(pojo);
    }
    //辅助函数，对课题中插入一行
    @PostMapping("/insertTaskListJobDescription")
    public Result insertTaskListJobDescription(@RequestBody taskListDataPojo pojo){
        jobDescriptionService.insertTaskList(pojo);
        return Result.success("插入成功");
    }
    //辅助函数，对课题中筛选出所有的数据
    @PostMapping("/inquiryTaskListAllJobDescription")
    public Result inquiryTaskListAllJobDescription(){
        List<taskListDataPojo> pojos=jobDescriptionService.inquiryTaskListAll();
        return Result.success(pojos);
    }
    //辅助函数，对课题中插入一行
    @PostMapping("/upDataTaskListJobDescription")
    public Result upDataTaskListJobDescription(@RequestBody taskListDataPojo pojo){
        jobDescriptionService.upDataTaskList(pojo);
        return Result.success("修改成功");
    }
}
